import React, { Component } from 'react';
import { Form } from 'antd';
const { Item } = Form;
const AntdFormItem = ({
  getFieldDecorator,
  label,
  code = '',
  initialValue = undefined,
  children,
  rules = [{ required: false, message: ' ' }],
}) => {
  
  return label !== undefined ? (
    <Item label={label}>
      {getFieldDecorator(code, {
        rules,
        initialValue,
      })(children)}
    </Item>
  ) : (
    getFieldDecorator(code, {
      rules,
      initialValue,
    })(children)
  );
};

export default AntdFormItem;
